package com.ljy.cart.config;


import com.ljy.cart.interceptor.CartInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class jymailWebConfig implements WebMvcConfigurer {

    /*
    * @TODO 视图逻辑
    * @author ljy
    * @time 2022-01-29 10:47:30
    * @method addViewControllers
    * @param param
    * @return void
    */
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/success.html").setViewName("success");
//        registry.addViewController("/cartList.html").setViewName("cartList");
    }

    /*
    * @TODO 添加拦截器
    * @author ljy
    * @time 2022-01-29 10:02:31
    * @method
    * @param param
    * @return
    */

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new CartInterceptor()).addPathPatterns("/**");
    }
}
